<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>会员信息 - 爽客网</title>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>

</head>
<body>
 
   <!-- person info -->
                        	<form  method="post" id="inforForm">
                            	<ul class="i_person_info">
                                	<li class="sepcial">
                                    	<label>用户名：</label>
                                    	<input type="text"  id="id" name="id" value="${member.id}" style="display: none;"/>
                                    	<input type="text" id="memberId" name="memberId" value="${member.id}" style="display: none;"/>
                                        <input type="text" class="input_txt" id="nickName" name="nickName" value="${member.nickname }" disabled="disabled"/>
                                        <p class="i_tip">可以修改一次，使用手机和用户名皆可登录爽客。(请输入4-16个字符，支持中文、英文、数字、下划线。)</p>
                                    </li>
                                    <li>
                                    	<label>姓名：</label>
                                        <input type="text" class="input_txt" id="userName" name="userName" value="${member.username}"/>
                                    </li>
                                    <li>
                                    	<label>性别：</label>
                                        <div class="i_sex">
                                        	<input type="radio" value="01" name="RadioGroup1" <c:if test="${memberDetail.sex=='01'}">checked='checked'</c:if> /><i class="fl">男士</i>
                                        	<input type="radio" value="02" name="RadioGroup1" <c:if test="${memberDetail.sex=='02'}">checked='checked'</c:if> /><i class="fl">女士</i>
                                        </div> 
                                    </li>
                                    <li>
                                   		 <div id="birthday">
	                                    	<label>出生日期：</label>
	                                        	<select name="year" id="year"></select>年
												<select name="month" id="month"></select>月
												<select name="day" id="day"></select>日
										</div>
                                    </li>
                                    <li>
                                    	<label>婚姻：</label>
                                        <select name="marry" id="marry">
                                            <option value="01" <c:if test="${memberDetail.marry=='01'}">selected='selected'</c:if>>已婚</option>
                                            <option value="02" <c:if test="${memberDetail.marry=='02'}">selected='selected'</c:if> >未婚</option>
                                            <option value="03" <c:if test="${memberDetail.marry=='03'}">selected='selected'</c:if> >恋爱中</option>
                                        </select>
                                    </li>
                                    <li>
                                    	<label>目前身份：</label>
                                        <select name="job" id="job">
                                            <option value="01" <c:if test="${memberDetail.job=='01'}">selected='selected'</c:if>>学生</option>
                                            <option value="02" <c:if test="${memberDetail.job=='02'}">selected='selected'</c:if>>待业</option>
                                            <option value="03" <c:if test="${memberDetail.job=='03'}">selected='selected'</c:if>>在职</option>
                                        </select>
                                    </li>
                                    <li class="i_area">
                                    	<div class="mb15">
	                                    	<label>居住地：</label>
	                                        <select id="province" name="province" style="width: 65px">
                                				<option selected="selected" >请选择</option>
		      					 		   </select>
			                                 <select id="city" name="city" style="width: 65px">
			                                 	<option selected="selected">请选择</option>
			                                 </select>
                                        </div>
                                        <div class="clear"></div>
                                        <div class="clearfix">
	                                        <label>家乡：</label>
	                                        <select id="provinceHome" name="provinceHome" style="width: 65px">
                                				<option selected="selected" >请选择</option>
		      					 		   </select>
			                                 <select id="cityHome" name="cityHome" style="width: 65px">
			                                 	<option selected="selected">请选择</option>
			                                 </select>
                                        </div>
                                        <p class="i_tip mt10">完善居住地及家乡信息以便我们为你推荐旅游景区！</p>
                                    </li>
                                    <li class="i_lt_sign">
                                    	<label>论坛签名：</label>
                                        <textarea id="introduction">${memberDetail.introduction}</textarea>
                                        <div class="clear"></div>
                                        <input type="image" src="../../images/smallpic/btn_83x23.png" class="i_submit" onclick="updateMInfor();" />
                                    </li>
                                </ul>
                            </form>
                        <!-- person info--end -->
</body>
<script type="text/javascript">

yearMonthDay($("#birthday"),"${memberDetail.birthday}");
initProvince('province', 'city');
initProvince('provinceHome', 'cityHome');
$(function() {
	provinceChange('province', 'city','', '',  '${member.provinceCode }','${member.cityCode }','', '');
	provinceChange('provinceHome', 'cityHome', '', '','${memberDetail.birthProvinceCode }','${memberDetail.birthCityCode }','', '');
});




function updateMInfor(){
		var year=$("#inforForm").find("#year").val();
		var month=$("#inforForm").find("#month").val();
		var day=$("#inforForm").find("#day").val();
		var birthday=year + '-'+ month + '-'+ day;
		var job=$("#inforForm").find("#job").val();
		var marry=$("#inforForm").find("#marry").val();
    	var sex =$(":radio[name='RadioGroup1'][checked]").val();
    	var provinceCode= $("#province").val();
		var cityCode=$("#city").val();
		var province=$("#province").find("option:selected").text();
		var city=$("#city").find("option:selected").text();
		var provinceHomeCode= $("#provinceHome").val();
		var cityHomeCode=$("#cityHome").val();
		var provinceHome=$("#provinceHome").find("option:selected").text();
		var cityHome=$("#cityHome").find("option:selected").text();
    	if(sex==null){
			alert("请选择性别");
			return;
		}else{
			$.post("updateMInfor.htm", {
					'username':$("#userName").val(),
					'id' :$("#id").val(),
					'memberId' : $("#memberId").val(),
					'sex' : $(":radio[name='RadioGroup1'][checked]").val(),
					'birthday': birthday,
					'job':job,
					'marry':marry,
					'province':province,
					'provinceCode': provinceCode,
					'city':city,
					'cityCode':cityCode,
					'birthProvince':provinceHome,
					'birthProvinceCode': provinceHomeCode,
					'birthCity':cityHome,
					'birthCityCode':cityHomeCode,
					'introduction' : $("#introduction").val()
				}, function(data) {
					if (data = 'success') {
						window.location.href="member.htm";
					}
				});
			}

}

</script>
</html>